package com.jinxiangyang.controller;

import com.jinxiangyang.annotation.OperateLog;
import com.jinxiangyang.service.FileService;
import com.jinxiangyang.utils.enums.BusinessType;
import com.jinxiangyang.utils.enums.OperatorType;
import com.jinxiangyang.utils.result.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.net.MalformedURLException;
import java.net.MulticastSocket;

/**
 * ClassName:FileUploadController
 * Description:
 *
 * @Author: jiangcheng
 * @Create: 2023/8/21 - 12:06
 * @Version: v1.0
 */

@Api(tags = "文件上传接口")
@RestController
@RequestMapping("/admin/vod/file")
@CrossOrigin
public class FileUploadController {


    @Autowired
    public FileService fileService;
    @ApiOperation("文件上传接口")
    @PostMapping("upload")
    @OperateLog(title = "上传文件模块",businessType = BusinessType.INSERT,operatorType = OperatorType.TEACHER)
    public AjaxResult uploadFile(MultipartFile file){
     String url =   fileService.upload(file);
        return AjaxResult.success(url);
    }

}
